﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace UnnamedPodcastLibrary
{
    public static class EpisodeState
    {
        /// <summary>
        /// The feed was downloaded and the existence of this episode is known.
        /// </summary>
        public static string InfoDownloaded = "InfoDownloaded";
        /// <summary>
        /// The episode download has begun.
        /// </summary>
        public static string DownloadStarted = "DownloadStarted";
        /// <summary>
        /// The episode download finished.
        /// </summary>
        public static string DownloadCompleted = "DownloadCompleted";
        /// <summary>
        /// The epiode was verified to exist in the Data directory, and the copy to the Sync dir has begin
        /// </summary>
        public static string SyncStarted = "SyncStarted";
        /// <summary>
        /// The episode was verified to exist in the Sync directory, and deleted from the Data directory
        /// </summary>
        public static string SyncCompleted = "SyncCompleted";

        public static IEnumerable<string> States
        {
            get
            {
                return new string[]{
                    InfoDownloaded,
                    DownloadStarted,
                    DownloadCompleted,
                    SyncStarted,
                    SyncCompleted
                };
            }
        }

        public static bool IsValid(string episodeState)
        {
            return States.Count((validState) => { return validState.Equals(episodeState, StringComparison.OrdinalIgnoreCase); }) > 0;
        }
    }
}
